home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form BinaryEdit
- BorderStyle = 1 'Fixed Single
- Caption = "View of Stream"
- ClientHeight = 3180
- ClientLeft = 1335
- ClientTop = 5565
- ClientWidth = 8760
- ClipControls = 0 'False
- Height = 3585
- Left = 1275
- LinkTopic = "Form1"
- ScaleHeight = 3180
- ScaleWidth = 8760
- Top = 5220
- Width = 8880
- Begin VB.ListBox BinaryList
- BeginProperty Font
- name = "Courier"
- charset = 0
- weight = 400
- size = 9.75
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 2370
- Left = 0
- TabIndex = 1
- Top = 120
- Width = 8775
- End
- Begin VB.CommandButton ButtonOK
- Caption = "Close"
- Default = -1 'True
- Height = 375
- Left = 7320
- TabIndex = 0
- Top = 2640
- Width = 1095
- End
- Attribute VB_Name = "BinaryEdit"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- ' Close Button. Unloads the dialog box
- Private Sub ButtonOK_Click()
- Unload BinaryEdit
- End Sub
- ' Get the binary data from global variables and put
- ' it into a read-only text box in hexadecimal format
- ' with text on the right side. This is hard coded
- ' for a particular sized text box and the ASCII
- ' character set.
- Private Sub Form_Load()
- Dim num As String
- Dim lines As String
- Dim TextPart As String
- Dim char As String
- Dim i, j As Integer
- Dim NumLines As Integer
- BaseForm.MousePointer = 11
- NumLines = (GlobalSize / 16)
- For i = 0 To NumLines
- ' first the line #
- num = CStr(i)
- Select Case Len(num)
- Case 0:
- num = "000"
- Case 1:
- num = "00" & num
- Case 2:
- num = "0" & num
- Case Else:
- End Select
- lines = lines & num & " "
-
- ' then the bin data and the chars
- TextPart = ""
- For j = 1 To 16
- If (((i * 16) + j) > GlobalSize) Then
- num = " "
- TextPart = TextPart & " "
- Else
- char = Mid(GlobalText, (i * 16) + j, 1)
- num = Hex$(Asc(char))
- If (Len(num) = 0) Then num = "00" Else
- If (Len(num) = 1) Then num = "0" & num
-
- If (char < " ") Then
- TextPart = TextPart & "."
- Else
- TextPart = TextPart & char
- End If
- End If
- lines = lines & num & " "
- Next j
- lines = lines & " " & TextPart
- On Error GoTo listOverflow
- BinaryList.AddItem lines
- On Error GoTo 0
- lines = ""
- Next i
- BaseForm.MousePointer = 0
- Exit Sub
- listOverflow:
- MsgBox "The stream is too large." & Chr$(13) & "As much of the stream will be shown as is possible."
- BaseForm.MousePointer = 0
- Exit Sub
- End Sub
- ' This only allows keypresses that correspond to
- ' hexidecimal numbers or text editing to work.
- Private Sub ValueBinary_KeyPress(KeyAscii As Integer)
- Dim char As String * 1
- char = LCase$(Chr$(KeyAscii))
- ' Let deletes and backspaces through
- If (KeyAscii = 8) Then Exit Sub
- ' only accept hexadecimal numbers
- If ((char <= "f") And (char >= "a")) Or ((char <= "9") And (char >= "0")) Then
- KeyAscii = Asc(LCase$(Chr$(KeyAscii)))
- Else
- KeyAscii = 0
- End If
- End Sub
-